#include <err.h>
#include <stdio.h>
#include <getopt.h>
#include <unistd.h>

#include "../getopt_helper.h"

static struct option const LONG_OPTIONS[] = { GETOPT_END_DECL };

#define NFORMAT 2
static const char usage_str[] =
    "Usage: %s FILE...\n"
    "  or:  %s OPTION\n"
    "Call the unlink function to remove the specified FILE(s).\n"
    "\n"
    "      --help     display this help and exit\n"
    "      --version  output version information and exit";

int
main(int argc, char* argv[])
{
	int ch, status = 0;
	while ((ch = getopt_long(argc, argv, "", LONG_OPTIONS, NULL)) != -1) {
		switch (ch) {
			GETOPT_END_CASE
		}
	}

	if (argc <= optind) errx(!0, "missing operand");

	for (argv += optind; *argv; ++argv) {
		if (unlink(*argv)) {
			status = !0;
			warn("cannot unlink '%s'", *argv);
		}
	}

	return status;
}
